package com.ruoyi.app.controller

import com.ruoyi.app.common.Data
import com.ruoyi.app.domain.vo.SpreadCenterBannerVo
import com.ruoyi.app.domain.vo.SpreadCenterVo
import com.ruoyi.app.service.SpreadCenterApiService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiImplicitParam
import io.swagger.annotations.ApiImplicitParams
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("api/spreadCenter")
@Api(tags = ["推广中心相关接口"])
class SpreadCenterApiController {

    @Autowired
    private lateinit var spreadCenterApiService: SpreadCenterApiService


    @ApiOperation("获取推广中心轮播图列表")
    @GetMapping("getSpreadCenterBannerList")
    fun getSpreadCenterBannerList(): Data<List<SpreadCenterBannerVo>> = spreadCenterApiService.getSpreadCenterBannerList()


    @ApiOperation("获取IOS推广中心轮播图列表")
    @GetMapping("getIosSpreadCenterBannerList")
    fun getIosSpreadCenterBannerList(): Data<List<SpreadCenterBannerVo>> = spreadCenterApiService.getIosSpreadCenterBannerList()


    @ApiOperation("获取推广中心app列表")
    @GetMapping("getSpreadCenterAppList/{type}")
    @ApiImplicitParams(
        ApiImplicitParam(
            name = "type",
            value = "2.中间 3.下方",
            type = "path",
            required = true
        )
    )
    fun getSpreadCenterAppList(@PathVariable type: Int): Data<List<SpreadCenterVo>> = spreadCenterApiService.getSpreadCenterAppList(type)



    @ApiOperation("获取IOS推广中心app列表")
    @GetMapping("getIOSSpreadCenterAppList")
    @ApiImplicitParams(
        ApiImplicitParam(
            name = "type",
            value = "2.中间 3.下方",
            type = "path",
            required = true
        )
    )
    fun getIOSSpreadCenterAppList(type: Int): Data<List<SpreadCenterVo>> = spreadCenterApiService.getIOSSpreadCenterAppList(type)
}